package cn.edu.nuc.android.oweibo.layouts;

import cn.edu.nuc.android.oweibo.R;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class LoadMoreListItem extends RelativeLayout {
	
	private TextView loadMoreTextView;
	private ProgressBar progressIndicator;

	public LoadMoreListItem(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void onFinishInflate() {
		super.onFinishInflate();
		findViews();
	}

	private void findViews() {
		loadMoreTextView = (TextView)findViewById(R.id.load_more_text);
		progressIndicator = (ProgressBar)findViewById(R.id.load_more_progress);
	}

	public void showHeaderText() {
		String headerText = getResources().getString(R.string.load_more_header);
		loadMoreTextView.setText(headerText);
	}
	
	public void showFooterText() {
		String footerText = getResources().getString(R.string.load_more_footer);
		loadMoreTextView.setText(footerText);
	}

	public void showProgress() {
		progressIndicator.setVisibility(VISIBLE);
	}

	public void hideProgress() {
		progressIndicator.setVisibility(INVISIBLE);
	}

}
